package main

import (
	"fmt"
	"strconv"
)

func main() {
	// str 转 int
	newStr1 := "1"
	intValue, _ := strconv.Atoi(newStr1)
	fmt.Printf("%T,%d\n", intValue, intValue)

	// int 转 str
	intValue2 := 2
	strValue := strconv.Itoa(intValue2)
	fmt.Printf("%T,%s\n", strValue, strValue)

	// str 转  float
	string3 := "3.1415926"
	f, _ := strconv.ParseFloat(string3, 64)
	fmt.Printf("%T, %f\n", f, f)

	//float 转 string
	floatValue := 3.1415926
	formatFloat := strconv.FormatFloat(floatValue, 'f', 8, 64)
	fmt.Printf("%T,%s", formatFloat, formatFloat)

}
